//
//  ZoneViewController.m
//  09-HomeWork
//
//  Created by dllo on 16/7/26.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "ZoneViewController.h"
#import "Zone.h"
#define kTableViewCellReuse @"reuseIdentifier"
@interface ZoneViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *zoneTableView;
@end
@implementation ZoneViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creteTableView];
}
#pragma mark - 创建tableView
- (void)creteTableView {
    self.zoneTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    [self.view addSubview:_zoneTableView];
    _zoneTableView.dataSource = self;
    _zoneTableView.delegate = self;
}
#pragma mark - tableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _arrOfZone.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kTableViewCellReuse];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kTableViewCellReuse];
    }
    Zone *zone = _arrOfZone[indexPath.row];
    NSArray *arr = [zone.name componentsSeparatedByString:@" "];
    cell.textLabel.text = arr[4];
    cell.detailTextLabel.text = arr[5];
    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
